export default [
  {
    url: "/login",
    type: "post",
    response(data: any) {
      if (
        (data.username === "admin" && data.password === "admin") ||
        (data.username === "user" && data.password === "user")
      ) {
        return {
          code: 200,
          msg: "success",
          data: {
            token: data.username,
          },
        };
      } else
        return {
          code: 300,
          msg: "fail",
          data: "",
        };
    },
  },
  {
    url: "/user/info",
    type: "post",
    response(data: any) {
      return {
        code: 200,
        msg: "success",
        data:
          data.token === "admin"
            ? {
                id: 1,
                username: "admin",
                name: "管理员",
                avatar: "@/assets/images/moren.gif",
                role: ["admin"],
                permission: [],
              }
            : {
                id: 2,
                username: "user",
                name: "用户",
                avatar: "@/assets/images/moren.gif",
                role: ["user"],
                permission: [],
              },
      };
    },
  },
];
